Skip to content

[US-14.3 / OBT-248] Role tag on user cards: Member/Manager/Admin - #34

Open
levigtri wants to merge 2 commits into
mainfrom
levigft/obt-248-us-143-role-tag-on-user-cards-membermanageradmin-with
Open

[US-14.3 / OBT-248] Role tag on user cards: Member/Manager/Admin#34
levigtri wants to merge 2 commits into
mainfrom
levigft/obt-248-us-143-role-tag-on-user-cards-membermanageradmin-with

Conversation

@levigtri

Copy link
Copy Markdown
Member

[US-14.3 / OBT-248] Role tag on user cards: Member/Manager/Admin

Summary

Every user card on the Users page now shows exactly one role tag — Member, Manager, or Admin — each with a distinct color and icon. Previously only platform admins had a tag (the telha Shield badge), so members and managers were visually indistinguishable. The role comes from the new role field exposed by the backend in UserListResponse (US-14.2: platform_admin if is_platform_admin, else manager if the user manages at least one project, else member), with a client-side fallback for older API responses that do not send the field.

Changes

  1. UserRole type and optional role field — src/types/user.ts
    Adds export type UserRole = "member" | "manager" | "platform_admin" and the optional field role?: UserRole to UserListResponse. The field is optional on purpose so the frontend tolerates API versions that predate US-14.2.

  2. Barrel re-export — src/types/index.ts
    Re-exports UserRole by name from ./user so it can be imported from @/types like the other user types.

  3. manager and member badge variants — src/components/ui/badge.tsx
    Adds two Badge variants after admin: manager (bg-azul/25 text-verde border border-azul/60) and member (bg-areia/30 text-verde border border-areia), both using Shema design tokens so each role has a distinct color.

  4. Always-present role tag — src/components/pages/UsersPage/UserCard.tsx
    Replaces the user.is_platform_admin && <Badge variant="admin"> conditional with a single role badge rendered for every card, driven by a role -> { variant, icon, label } map: platform_admin keeps the current visual (admin variant + Shield), manager uses the manager variant + UserCog, member uses the member variant + User icon. Role resolution is user.role ?? (user.is_platform_admin ? "platform_admin" : "member"), preserving precedence platform_admin > manager > member. The Active/Inactive badge stays alongside it, and lucide's User icon is imported as UserIcon to avoid colliding with the User type.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Refactor
  • Documentation

Testing

  • npm run typecheck — passes with no errors.
  • npm run lint — 0 errors (only the pre-existing react-hooks/exhaustive-deps warning in ProjectsPage.tsx).
  • npm run build — production build succeeds.
  • Manual reasoning over the role fallback: with role present the API value wins; without it, platform admins keep the Admin tag and everyone else shows Member, matching the pre-US-14.2 behavior plus the new always-visible tag.

levigtri and others added 2 commits July 10, 2026 00:50
Every user card on the Users page now displays exactly one role badge
with a distinct color, instead of only platform admins having a tag.

- Add UserRole type and optional role field to UserListResponse,
  matching the derived role exposed by the backend (US-14.2); the
  field is optional so older API responses still work
- Add manager and member Badge variants with Shema tokens
- UserCard renders the role badge via a role -> {variant, icon, label}
  map with precedence platform_admin > manager > member, falling back
  to is_platform_admin when the API does not send role
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@levigtri, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 42 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: QUIET

Plan: Pro Plus

Run ID: 8878d8c5-2c41-4f7a-99fc-88d227ff9550

📥 Commits

Reviewing files that changed from the base of the PR and between 130fc4a and d4c64cf.

📒 Files selected for processing (4)
  • src/components/pages/UsersPage/UserCard.tsx
  • src/components/ui/badge.tsx
  • src/types/index.ts
  • src/types/user.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch levigft/obt-248-us-143-role-tag-on-user-cards-membermanageradmin-with

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant